import Utils from './common.js'

const cookie_pre = 'sinnpoo_admin'

const  Storage ={
  set: function (key, value) {
    if (typeof(value) == "string") {
      localStorage.setItem(key, value);
    }else if (typeof(value) == "object") {
      localStorage.setItem(key, JSON.stringify(value));
    }
  },
  get: function (key) {
    let result = localStorage.getItem(key);
    if (Utils.isJSON(result)) {
      result = JSON.parse(result);
    }
    return result;
  },
  remove: function (key) {
    localStorage.setItem(key, null);
  }
}



export default Storage
